<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class ListNews extends My_Controller {

    public function __construct() {
        parent::__construct();
    }

    /**
     * Index Page for this controller.

     */
    public function index() {
        //Add css into template
        $dataView['imageFrontPath'] = $this->_config['base_url'] . $this->_staticPathPublic . 'images';
        $this->template->parse_view('content', $this->_viewFront . 'list_view', $dataView);
        $this->template->render();
    }

    /**
     * 
     */
    public function block_hotnews() {

        $CI = & get_instance();

        $CI->load->model('frontend/category_model', 'Category', TRUE);
        $CI->load->model('frontend/article_model', 'Article', TRUE);
        $cate_result = $CI->Category->sec_GetALLCategory(NULL);
        echo '<pre>';
        print_r($cate_result);
        die;
//        foreach ($cate_result as &$c) {
//            $c->childs = $CI->Category->sec_GetCategoryByParrent(array('catid' => $c->id));
//            $articles = $CI->Article->arc_GetNewestByCate(array('catid' => $c->id));
//            $i = 0;
//            foreach ($articles as $art) {
//                if ($i == 0) {
//                    $c->articles['hotnews1'] = $art;
//                } else if ($i == 1) {
//                    $c->articles['hotnews2'] = $art;
//                } else {
//                    $c->articles['hotnews3'][] = $art;
//                }
//                if ($i++ > 4)
//                    break;
//            }
//        }
//        $data['cate_result'] = $cate_result;
//        $this->load->view($this->_config['front_path'] . 'newsbyobject_view', $data);
    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */